---
title: 國際化
icon: Earth
---

## 在預設模式中註冊語言包

預設包中已經包含其對應外掛的語言包，只需自預設引入即可。

```typescript
import { UniverSheetsCorePreset } from '@univerjs/preset-sheets-core'
import UniverPresetSheetsCoreZhTW from '@univerjs/preset-sheets-core/locales/zh-TW' // [!code highlight]
import { createUniver, LocaleType, mergeLocales } from '@univerjs/presets'

const { univerAPI } = createUniver({
  locale: LocaleType.ZH_TW,
  locales: {
    [LocaleType.ZH_TW]: mergeLocales(
      UniverPresetSheetsCoreZhTW, // [!code highlight]
    ),
  },
  presets: [
    UniverSheetsCorePreset(),
  ],
})
```

## 在外掛模式中註冊語言包

使用外掛語言包相對繁瑣；你需要自具有語言包的外掛中引入對應的語言物件，並將它們合併成一個物件後傳入 `Univer` 實例。以下是一個示例：

```typescript
import { LocaleType, mergeLocales, Univer } from '@univerjs/core'
import DesignZhTW from '@univerjs/design/locale/zh-TW' // [!code highlight]
import SheetsUIZhTW from '@univerjs/sheets-ui/locale/zh-TW' // [!code highlight]
import UIZhTW from '@univerjs/ui/locale/zh-TW' // [!code highlight]

const univer = new Univer({
  locale: LocaleType.ZH_TW,
  locales: {
    [LocaleType.ZH_TW]: mergeLocales(
      DesignZhTW, // [!code highlight]
      UIZhTW, // [!code highlight]
      SheetsUIZhTW, // [!code highlight]
    ),
  },
})
```

<include cwd>content/guides/shared/getting-started/i18n.zh-TW.mdx</include>
